package main

import (
	"github.com/valyala/fasthttp"
	"gopkg.in/alecthomas/kingpin.v2"
)

var (
	dbname               = kingpin.Flag("db", "database name").Default("bolt.db").String()
	basepath             = kingpin.Flag("path", "base path").Default(".").String()
	port                 = kingpin.Flag("port", "port to listen").Default("8888").Short('p').String()
	addr                 = kingpin.Flag("addr", "addr to listen").Default("").Short('a').String()
	logfile              = kingpin.Flag("log", "log file").Default("bolt.log").Short('l').String()
	IntervalToBatchWrite = kingpin.Flag("interval", "interval (in minutes) to batch write").Default("60").Short('i').Int()
	MaxSizeOfBuffer      = kingpin.Flag("buffer", "max size of contents to write in buffer").Default("10240000").Short('b').Int()
)

func main() {
	kingpin.Parse()
	srv := Server{}
	srv.Setup()
	defer srv.Close()
	fasthttp.ListenAndServe(*addr+":"+*port, srv.Handle)
}
